
<!--
/**************************************************
* @ operatorfuncquery.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/, Simonyi Peng
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>

<html>
<head>
<title>操作员权限查询</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--<LINK href="< %=root%>/css/css.css" type=text/css rel=stylesheet>-->
<LINK href="<%=root%>/css/caigouxitong.css"" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>

<%
	ArrayList a = (ArrayList)request.getAttribute("organdoper");
	HashMap orglist = (HashMap)a.get(0);
	HashMap operlist = (HashMap)a.get(1);
	ArrayList orgbyNamelist = (ArrayList)a.get(2);
	ArrayList tList=new ArrayList();
	ResultProcess tGSOper = (ResultProcess)request.getAttribute("operator");
	String tReQuery = (String)request.getAttribute("requery");
%>
<script language="JavaScript">
	var counter;
	
	//初始化	    
	var orglist = new Array();
	var operlist = new Array();
	var operlisttemp ;
	<%
		for(int j=0;j<orgbyNamelist.size();j++)
		{
			String[] org = (String[])orgbyNamelist.get(j);
		%>
			orglist[<%=j%>] = '<%=org[0] + "|" + org[1] %>';
    		operlisttemp = new Array();
    		<%
    			ArrayList operlistTemp = (ArrayList)operlist.get(org[0]);
    			for(int i=0;i<operlistTemp.size();i++)
    			{
    				String[] oper = (String[])operlistTemp.get(i);
    		%>
    				operlisttemp[<%=i%>] = '<%=oper[0]+"|"+oper[1]%>';
    		<%
    			}
    		%>
   				operlist[<%=j%>] = operlisttemp;   		
		<%
		}
	%>
	
	function changeOperByDept(){
		var deptid=eval('document.all.operorgid.selectedIndex;');
		var operid = document.getElementById('operid');
		var operid_ = '<%=request.getParameter("operid")%>';
		var opername = document.getElementById('opername');
		var opername_ = '<%=request.getParameter("opername")%>';
 		var length=operid.length;
		for (i=1;i<length;i++)
		{
			eval("document.all.operid.options["+(length-i)+"]=null;");
			eval("document.all.opername.options["+(length-i)+"]=null;");
		}
		//当选择了订货部门
		if(deptid!=0){
			var addrTemp = operlist[deptid-1];
			for(i=0;i<addrTemp.length;i++){
				var msg = addrTemp[i];
				var sz = StringTokenize(msg,'|',0,null);
				var tempoption_id=new	Option(sz[0],sz[0]);
				var tempoption_name=new	Option(sz[1],sz[1]);
				eval('document.all.operid.options[i+1]=tempoption_id;');
				eval('document.all.opername.options[i+1]=tempoption_name;');
				if(operid_ != null && sz[0] == operid_){
					eval('document.all.operid.options[i+1].selected=true;');
				}
				if(opername_ != null && sz[1] == opername_){
					eval('document.all.opername.options[i+1].selected=true;');					
				}
			}
		}
	}
	
	function process(val){
	     if(val == 'Q' || val == 'Qre'){
				  if (val == 'Qre') {
					<%
					    if(tReQuery!=null && tReQuery.equals("true")){
					%>
						operatorfuncform.action = "<%= response.encodeURL(request.getContextPath() + "/A400602.do") %>";
		                operatorfuncform.submit();
                        return true;
			    	<%}%>
		    	} else if (val == 'Q') {
					operatorfuncform.action = "<%= response.encodeURL(request.getContextPath() + "/A400602.do") %>";
	                operatorfuncform.submit();
                    return true;
		    	}
    	
		}
		
	}
	function mod(val1,val2){
		var result = null;	
	    result = window.open ("<%= response.encodeURL(request.getContextPath() + "/A400603.do") %>?operid="+val1+"&opername="+val2,'newwindow','height=600,width=900,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no') 	
	}
	function openwin(value){
		showModalDialog("<%=root%>/jsp/showimage.jsp?path="+value,window,"status:no;unadorned:yes;dialogWidth:375px;dialogHeight:400px;help:no;");
	}
	
	function clean(){

		operatorfuncform.operorgid.value="";		
				
		var listbox = document.getElementById("operid");
		listbox.length = 0;
		var option = new Option();
		option.text = "-----请选择-----";
		option.value = "";			
		listbox.options[listbox.length] = option;	  

		var listbox2 = document.getElementById("opername");
		listbox2.length = 0;
		var option2 = new Option();
		option2.text = "-----请选择-----";
		option2.value = "";			
		listbox2.options[listbox2.length] = option2;
		
		operatorfuncform.keyWord.value="";	
    }
</script>
</head>
<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<form name="operatorfuncform" method="get" >

<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">功能权限设定</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>
<br>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				
				<TR height=20>
					<TD class="bg_column" align=center>所属单位</TD>
					<TD align=left class="bg_row_odd">
						<select id ='operorgid' name='operorgid' onChange='changeOperByDept()'>
							<option value=''>-----请选择-----</option>
    <%
    		String operorgid = request.getParameter("operorgid");	
    		for(int i=0;i<orgbyNamelist.size();i++)
    		{
    			String[] orgval = (String[])orgbyNamelist.get(i);
    		%>
    			<option value='<%=orgval[0]%>' <%if(orgval[0].equals(operorgid)) out.print("selected");%>><%=orgval[1]%></option>
    		<%
    		}
    %>
                   		    
						</select>
					</TD>
					<TD class="bg_column" align=center>操作员姓名</TD>
					<TD align=left class="bg_row_odd">
						<select id='opername'  name='opername'>
							<option value=''>-----请选择-----</option>
						</select>
					</TD>
					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>操作员帐号</TD>
					<TD align=left class="bg_row_odd">
						<select id ='operid' name='operid'>
							<option value=''>-----请选择-----</option>
						</select>
					</TD>
					<TD class="bg_column" align=center>关键字</TD>
					<TD align=left class="bg_row_odd">
						<input type="text" name="keyWord" value="<%=request.getParameter("keyWord")==null? "":request.getParameter("keyWord") %>">&nbsp;&nbsp;(帐号/姓名/职务)
					</td>
				</TR>
	<%
    			if(operorgid != null && operorgid != "") {
    %>
    				<script language='javascript'>changeOperByDept();</script>
    <%			
    			}								
    %>
			</table>
		</td>
	</tr>
</table>
<%
int totalRecords = 0;
if(tGSOper != null){
        
        int defaultPageSize = Integer.parseInt(GSBaseConstants.tPage);
        totalRecords = tGSOper.getRecordsSize();
%>          
<page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'>
<% tList = tGSOper.getDisplayRecords(index.intValue(),pageSize.intValue()); %>
</page:pager>
<%} %>
</form>
    <p align="center">  
<!--		<input type="image" src="images/button/chaxun.gif" width="58" height="24" class="box" onclick="process()"/>&nbsp;-->
		<input type="button" name="查询" value="查询" class="kuang" onclick="process('Q')"/>&nbsp;
		<input type="button" name="清空" value="清空" class="kuang" onclick="clean()"/>&nbsp;
    </p>
<%
	
	if(tGSOper != null){
%>
	<center>
    <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
			<input type="hidden" name="totalRecords" value="<%=totalRecords%>">
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20> 
                        <td class=top align=middle> 
                        <div align="center" class="txt_content"></div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">操作员帐号</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">操作员名称</div>
						</td>
						<td class=top align=middle> 
                        <div align="center" class="txt_content">操作员职务</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">所属单位</div>
						</td>
					</tr>
					<%
						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							String[] tStr = (String[])tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}
					%>
							<tr <%=tTempStr%> height=20>
							    <td class=top align=middle> 
								<div align="center" class="txt_content">

	                                 <input type="button" value="修改" class="kuang" onClick="mod('<%=tStr[0]%>','<%=tStr[1]%>')">
                                </div>
								</td>
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[0]%>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[1]%>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[2]%>
									</div>
								</td>							
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[3]%>
									</div>
								</td>
							</tr> 
							
					<%	
							}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="12" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm="operatorfuncform"/>
						    </td>
						  
				    <%
						}else{
					%>
							<font color="red">没有符合条件的操作员信息</font>
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
<%		
	}
%>
</body>
</html>